package com.sm.scorpio.ui.fragment.message;

import android.os.Bundle;
import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.sm.imlibrary.imsdk.SIMConversation;
import com.sm.imlibrary.imsdk.SIMMessage;
import com.sm.imlibrary.model.Conversation;
import com.sm.imlibrary.presenter.ConversationPresenter;
import com.sm.imlibrary.viewfeatures.ConversationView;
import com.sm.scorpio.R;
import com.sm.scorpio.ui.activity.chat.ChatActivity;
import com.sm.scorpio.ui.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * created by zhud on 2019/6/6
 */
public class MessageFragment extends BaseFragment implements BaseQuickAdapter.OnItemChildClickListener, ConversationView {
    private List<Conversation> conversations = new ArrayList<>();
    private MessageAdapter adapter;
    private ConversationPresenter presenter;
    @Override
    protected int onCreateLayout() {
        return R.layout.fragment_message;
    }

    @Override
    protected void onInit(Bundle savedInstanceState) {
        v.setText(R.id.title_text, R.string.string_00004);
        for (int i = 0; i < 100; i++) {
            conversations.add(new Conversation());
        }
        v.setRecyclerViewAdapter(R.id.recyclerView, adapter = new MessageAdapter(conversations))
                .setRecyclerViewLayoutManager(R.id.recyclerView, new LinearLayoutManager(mContext));
        presenter = new ConversationPresenter(this);
        adapter.setOnItemChildClickListener(this);
    }

    @Override
    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
        switch (view.getId()) {
            case R.id.message_item_layout:
                skipActivity(ChatActivity.class);
                break;
        }
    }

    @Override
    public void initView(List<SIMConversation> conversationList) {

    }

    @Override
    public void updateMessage(SIMMessage message) {

    }

    @Override
    public void updateFriendshipMessage() {

    }

    @Override
    public void removeConversation(String identify) {

    }

    @Override
    public void refresh() {

    }
}
